﻿﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace NewsPub
{
    /// <summary>网上互动</summary>
    [Serializable]
    [DataObject]
    [Description("网上互动")]
    [BindIndex("PK_Communicate", true, "ID")]
    [BindIndex("IX_Communicate_ClassisID", false, "ClassisID")]
    [BindRelation("ClassisID", false, "Classis", "ID")]
    [BindTable("Communicate", Description = "网上互动", ConnName = "NewsPub", DbType = DatabaseType.SqlServer)]
    public partial class Communicate<TEntity> : ICommunicate
    {
        #region 属性
        private Int32 _ID;
        /// <summary>编号</summary>
        [DisplayName("编号")]
        [Description("编号")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn(1, "ID", "编号", null, "int", 10, 0, false)]
        public virtual Int32 ID
        {
            get { return _ID; }
            set { if (OnPropertyChanging(__.ID, value)) { _ID = value; OnPropertyChanged(__.ID); } }
        }

        private String _ReferenceNumber;
        /// <summary>咨询编号</summary>
        [DisplayName("咨询编号")]
        [Description("咨询编号")]
        [DataObjectField(false, false, true, 500)]
        [BindColumn(2, "ReferenceNumber", "咨询编号", null, "nvarchar(500)", 0, 0, true)]
        public virtual String ReferenceNumber
        {
            get { return _ReferenceNumber; }
            set { if (OnPropertyChanging(__.ReferenceNumber, value)) { _ReferenceNumber = value; OnPropertyChanged(__.ReferenceNumber); } }
        }

        private String _Name;
        /// <summary>姓名</summary>
        [DisplayName("姓名")]
        [Description("姓名")]
        [DataObjectField(false, false, true, 500)]
        [BindColumn(3, "Name", "姓名", null, "nvarchar(500)", 0, 0, true)]
        public virtual String Name
        {
            get { return _Name; }
            set { if (OnPropertyChanging(__.Name, value)) { _Name = value; OnPropertyChanged(__.Name); } }
        }

        private Int32 _Occupation;
        /// <summary>职业</summary>
        [DisplayName("职业")]
        [Description("职业")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn(4, "Occupation", "职业", null, "int", 10, 0, false)]
        public virtual Int32 Occupation
        {
            get { return _Occupation; }
            set { if (OnPropertyChanging(__.Occupation, value)) { _Occupation = value; OnPropertyChanged(__.Occupation); } }
        }

        private String _Title;
        /// <summary>咨询标题</summary>
        [DisplayName("咨询标题")]
        [Description("咨询标题")]
        [DataObjectField(false, false, true, 500)]
        [BindColumn(5, "Title", "咨询标题", null, "nvarchar(500)", 0, 0, true)]
        public virtual String Title
        {
            get { return _Title; }
            set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } }
        }

        private String _Content;
        /// <summary>咨询内容</summary>
        [DisplayName("咨询内容")]
        [Description("咨询内容")]
        [DataObjectField(false, false, true, -1)]
        [BindColumn(6, "Content", "咨询内容", null, "nvarchar(MAX)", 0, 0, true)]
        public virtual String Content
        {
            get { return _Content; }
            set { if (OnPropertyChanging(__.Content, value)) { _Content = value; OnPropertyChanged(__.Content); } }
        }

        private Boolean _Publishable;
        /// <summary>是否网上公开</summary>
        [DisplayName("是否网上公开")]
        [Description("是否网上公开")]
        [DataObjectField(false, false, true, 1)]
        [BindColumn(7, "Publishable", "是否网上公开", null, "bit", 0, 0, false)]
        public virtual Boolean Publishable
        {
            get { return _Publishable; }
            set { if (OnPropertyChanging(__.Publishable, value)) { _Publishable = value; OnPropertyChanged(__.Publishable); } }
        }

        private DateTime _CreateTime;
        /// <summary>咨询时间</summary>
        [DisplayName("咨询时间")]
        [Description("咨询时间")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(8, "CreateTime", "咨询时间", null, "datetime", 3, 0, false)]
        public virtual DateTime CreateTime
        {
            get { return _CreateTime; }
            set { if (OnPropertyChanging(__.CreateTime, value)) { _CreateTime = value; OnPropertyChanged(__.CreateTime); } }
        }

        private String _Reply;
        /// <summary>回复意见</summary>
        [DisplayName("回复意见")]
        [Description("回复意见")]
        [DataObjectField(false, false, true, -1)]
        [BindColumn(9, "Reply", "回复意见", null, "nvarchar(MAX)", 0, 0, true)]
        public virtual String Reply
        {
            get { return _Reply; }
            set { if (OnPropertyChanging(__.Reply, value)) { _Reply = value; OnPropertyChanged(__.Reply); } }
        }

        private DateTime _ReplyTime;
        /// <summary>回复时间</summary>
        [DisplayName("回复时间")]
        [Description("回复时间")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(10, "ReplyTime", "回复时间", null, "datetime", 3, 0, false)]
        public virtual DateTime ReplyTime
        {
            get { return _ReplyTime; }
            set { if (OnPropertyChanging(__.ReplyTime, value)) { _ReplyTime = value; OnPropertyChanged(__.ReplyTime); } }
        }

        private Boolean _Verified;
        /// <summary>审核通过</summary>
        [DisplayName("审核通过")]
        [Description("审核通过")]
        [DataObjectField(false, false, true, 1)]
        [BindColumn(11, "Verified", "审核通过", null, "bit", 0, 0, false)]
        public virtual Boolean Verified
        {
            get { return _Verified; }
            set { if (OnPropertyChanging(__.Verified, value)) { _Verified = value; OnPropertyChanged(__.Verified); } }
        }

        private String _Email;
        /// <summary>电子邮箱</summary>
        [DisplayName("电子邮箱")]
        [Description("电子邮箱")]
        [DataObjectField(false, false, true, 500)]
        [BindColumn(12, "Email", "电子邮箱", null, "nvarchar(500)", 0, 0, true)]
        public virtual String Email
        {
            get { return _Email; }
            set { if (OnPropertyChanging(__.Email, value)) { _Email = value; OnPropertyChanged(__.Email); } }
        }

        private Int32 _ClassisID;
        /// <summary>咨询分类</summary>
        [DisplayName("咨询分类")]
        [Description("咨询分类")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn(13, "ClassisID", "咨询分类", null, "int", 10, 0, false)]
        public virtual Int32 ClassisID
        {
            get { return _ClassisID; }
            set { if (OnPropertyChanging(__.ClassisID, value)) { _ClassisID = value; OnPropertyChanged(__.ClassisID); } }
        }

        private String _VCode;
        /// <summary>验证码</summary>
        [DisplayName("验证码")]
        [Description("验证码")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(14, "VCode", "验证码", null, "nvarchar(50)", 0, 0, true)]
        public virtual String VCode
        {
            get { return _VCode; }
            set { if (OnPropertyChanging(__.VCode, value)) { _VCode = value; OnPropertyChanged(__.VCode); } }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case __.ID: return _ID;
                    case __.ReferenceNumber: return _ReferenceNumber;
                    case __.Name: return _Name;
                    case __.Occupation: return _Occupation;
                    case __.Title: return _Title;
                    case __.Content: return _Content;
                    case __.Publishable: return _Publishable;
                    case __.CreateTime: return _CreateTime;
                    case __.Reply: return _Reply;
                    case __.ReplyTime: return _ReplyTime;
                    case __.Verified: return _Verified;
                    case __.Email: return _Email;
                    case __.ClassisID: return _ClassisID;
                    case __.VCode: return _VCode;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case __.ID: _ID = Convert.ToInt32(value); break;
                    case __.ReferenceNumber: _ReferenceNumber = Convert.ToString(value); break;
                    case __.Name: _Name = Convert.ToString(value); break;
                    case __.Occupation: _Occupation = Convert.ToInt32(value); break;
                    case __.Title: _Title = Convert.ToString(value); break;
                    case __.Content: _Content = Convert.ToString(value); break;
                    case __.Publishable: _Publishable = Convert.ToBoolean(value); break;
                    case __.CreateTime: _CreateTime = Convert.ToDateTime(value); break;
                    case __.Reply: _Reply = Convert.ToString(value); break;
                    case __.ReplyTime: _ReplyTime = Convert.ToDateTime(value); break;
                    case __.Verified: _Verified = Convert.ToBoolean(value); break;
                    case __.Email: _Email = Convert.ToString(value); break;
                    case __.ClassisID: _ClassisID = Convert.ToInt32(value); break;
                    case __.VCode: _VCode = Convert.ToString(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得沟通字段信息的快捷方式</summary>
        public partial class _
        {
            ///<summary>编号</summary>
            public static readonly Field ID = FindByName(__.ID);

            ///<summary>咨询编号</summary>
            public static readonly Field ReferenceNumber = FindByName(__.ReferenceNumber);

            ///<summary>姓名</summary>
            public static readonly Field Name = FindByName(__.Name);

            ///<summary>职业</summary>
            public static readonly Field Occupation = FindByName(__.Occupation);

            ///<summary>咨询标题</summary>
            public static readonly Field Title = FindByName(__.Title);

            ///<summary>咨询内容</summary>
            public static readonly Field Content = FindByName(__.Content);

            ///<summary>是否网上公开</summary>
            public static readonly Field Publishable = FindByName(__.Publishable);

            ///<summary>咨询时间</summary>
            public static readonly Field CreateTime = FindByName(__.CreateTime);

            ///<summary>回复意见</summary>
            public static readonly Field Reply = FindByName(__.Reply);

            ///<summary>回复时间</summary>
            public static readonly Field ReplyTime = FindByName(__.ReplyTime);

            ///<summary>审核通过</summary>
            public static readonly Field Verified = FindByName(__.Verified);

            ///<summary>电子邮箱</summary>
            public static readonly Field Email = FindByName(__.Email);

            ///<summary>咨询分类</summary>
            public static readonly Field ClassisID = FindByName(__.ClassisID);

            ///<summary>验证码</summary>
            public static readonly Field VCode = FindByName(__.VCode);

            static Field FindByName(String name) { return Meta.Table.FindByName(name); }
        }

        /// <summary>取得沟通字段名称的快捷方式</summary>
        partial class __
        {
            ///<summary>编号</summary>
            public const String ID = "ID";

            ///<summary>咨询编号</summary>
            public const String ReferenceNumber = "ReferenceNumber";

            ///<summary>姓名</summary>
            public const String Name = "Name";

            ///<summary>职业</summary>
            public const String Occupation = "Occupation";

            ///<summary>咨询标题</summary>
            public const String Title = "Title";

            ///<summary>咨询内容</summary>
            public const String Content = "Content";

            ///<summary>是否网上公开</summary>
            public const String Publishable = "Publishable";

            ///<summary>咨询时间</summary>
            public const String CreateTime = "CreateTime";

            ///<summary>回复意见</summary>
            public const String Reply = "Reply";

            ///<summary>回复时间</summary>
            public const String ReplyTime = "ReplyTime";

            ///<summary>审核通过</summary>
            public const String Verified = "Verified";

            ///<summary>电子邮箱</summary>
            public const String Email = "Email";

            ///<summary>咨询分类</summary>
            public const String ClassisID = "ClassisID";

            ///<summary>验证码</summary>
            public const String VCode = "VCode";

        }
        #endregion
    }

    /// <summary>沟通接口</summary>
    public partial interface ICommunicate
    {
        #region 属性
        /// <summary>编号</summary>
        Int32 ID { get; set; }

        /// <summary>咨询编号</summary>
        String ReferenceNumber { get; set; }

        /// <summary>姓名</summary>
        String Name { get; set; }

        /// <summary>职业</summary>
        Int32 Occupation { get; set; }

        /// <summary>咨询标题</summary>
        String Title { get; set; }

        /// <summary>咨询内容</summary>
        String Content { get; set; }

        /// <summary>是否网上公开</summary>
        Boolean Publishable { get; set; }

        /// <summary>咨询时间</summary>
        DateTime CreateTime { get; set; }

        /// <summary>回复意见</summary>
        String Reply { get; set; }

        /// <summary>回复时间</summary>
        DateTime ReplyTime { get; set; }

        /// <summary>审核通过</summary>
        Boolean Verified { get; set; }

        /// <summary>电子邮箱</summary>
        String Email { get; set; }

        /// <summary>咨询分类</summary>
        Int32 ClassisID { get; set; }

        /// <summary>验证码</summary>
        String VCode { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值。</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}